home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SunSoft Catalyst CDWARE 1996 May to August
/
Catalyst CDWARE 1996 May to August.iso
/
.products
/
.bin
/
httpd
/
Solaris_2
/
catIPX.csh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1995-10-25
|
5KB
|
179 lines
#!/bin/csh
# below is a scrpit launched by catIPX.pl from CDware
# It ultimately generates a query page to be
# displayed by the cgi-bin/catIPX.pl script.
# Jun 6, 1995 Marc Sacoolas
setenv ONLY_ONE spam
set testdrvflg = 0
set installflg = 0
set osflg = 0
#
# Get search string, filter-type and category
#
set keyword = `awk -F^ '{ print $1 }' /tmp/httpd/tmp `
set install = `awk -F^ '{ print $2 }' /tmp/httpd/tmp `
set testdrive = `awk -F^ '{ print $3 }' /tmp/httpd/tmp `
set ostype = `awk -F^ '{ print $4 }' /tmp/httpd/tmp | sed 's/ //g'`
# clear temporary files
rm /tmp/httpd/tmppage.html
#touch /tmp/httpd/tmppage.html
rm /tmp/httpd/top
touch /tmp/httpd/top
#
# goto index.html directory and grep files for keyword --main list
#
cd ../../../../.products
foreach dir (`ls`)
if ( $dir == "hotjava" || $dir == "tmp" || $dir == "CDware" ) next
# set flags for filters
if ( $ostype != "OSType" ) then
set osflg = ` nawk -F^ ' { if (NR == 2) exit; if ( $3 ~ /'"$ostype"'/ ) {print "0"} else {print "1"} }' $dir/_info `
endif
if ( $testdrive == "testdrive" ) then
set testdrvflg = ` awk -F^ ' { if (NR == 2) exit; if ( $3 ~ /'"$testdrive"'/ ) {print "0"} else {print "1"} }' $dir/_info `
endif
if ( $install == "install" ) then
set installflg = ` awk -F^ ' { if (NR == 2) exit; if ( $3 ~ /'"$install"'/ ) {print "0"} else {print "1"} }' $dir/_info `
endif
# check to see if a blank query is given - make it *all*
if ( $keyword != "ALL" ) then
set yes = `grep -il $keyword $dir/index.html `
else
set yes = "spam"
endif
if ( $yes != "" && $installflg == "0" && $testdrvflg == "0" && $osflg == "0") then
# read in company name and log
nawk -F^ ' { if (NR == 1) { \
print ""$1"^"$2"^'"$dir"'^"} \
}' $dir/_info >> /tmp/httpd/top
endif
set testdrvflg = 0
set installflg = 0
end
sort -o /tmp/httpd/top.sort /tmp/httpd/top
cd ../.products/.bin/httpd/cgi-bin
#
# creat new page based on resource file generated above
#
if ( -z /tmp/httpd/top.sort ) then
cat head.html > /tmp/httpd/tmppage.html
echo "<p><hr><center>" >> /tmp/httpd/tmppage.html
echo "<h1>Your search produced no results</H1>" >> /tmp/httpd/tmppage.html
echo "<h2><p>Try again, or use category, company, or product listings.</H1>" >> /tmp/httpd/tmppage.html
echo "<p></center>" >> /tmp/httpd/tmppage.html
echo '<app class=delay sound="./main.au" img="../../../CDware/images/comp-prod/clear.gif" del="4800" href="file:///tmp/httpd/.products/CDware/search.html"> ' >> /tmp/httpd/tmppage.html
else
cat head.html > /tmp/httpd/tmppage.html
# get number of answers and print
set return = `grep -c ^ /tmp/httpd/top`
# if only one reslut, go there
if ( $return == 1 ) then
touch /tmp/httpd/only_one
exit 0
endif
if ( $return == 1 ) then
set booths = "Company."
else
set booths = "Companies."
endif
echo "<I> Your search for </I>'<B>$keyword</B>' <I>produced </I><B>$return</B> <I> $booths</I>" >> /tmp/httpd/tmppage.html
echo "<p>" >> /tmp/httpd/tmppage.html
# make main txt
echo "</pre>" >> /tmp/httpd/tmppage.html
echo "<DL>" >> /tmp/httpd/tmppage.html
echo '<hr>' >> /tmp/httpd/tmppage.html
echo '<p>' >> /tmp/httpd/tmppage.html
# only include if over some ammount
if ( $return >= 12 ) then
echo '<B><FONT size="-1">' /tmp/httpd/tmppage.html
echo '<B>Search for--</b><A HREF="/tmp/httpd/tmppage.html#A">A</A> <A HREF="/tmp/httpd/tmppage.html#B">B</A> <A HREF="/tmp/httpd/tmppage.html#C">C</A> <A HREF="/tmp/httpd/tmppage.html#D">D</A>' >> /tmp/httpd/tmppage.html
echo '<A HREF="/tmp/httpd/tmppage.html#E">E</A> <A HREF="/tmp/httpd/tmppage.html#F">F</A> <A HREF="/tmp/httpd/tmppage.html#G">G</A> <A HREF="/tmp/httpd/tmppage.html#H">H</A>' >> /tmp/httpd/tmppage.html
echo '<A HREF="/tmp/httpd/tmppage.html#I">I</A> <A HREF="/tmp/httpd/tmppage.html#J">J</A> <A HREF="/tmp/httpd/tmppage.html#K">K</A> <A HREF="/tmp/httpd/tmppage.html#L">L</A>' >> /tmp/httpd/tmppage.html
echo '<A HREF="/tmp/httpd/tmppage.html#M">M</A> <A HREF="/tmp/httpd/tmppage.html#N">N</A> <A HREF="/tmp/httpd/tmppage.html#O">O</A> <A HREF="/tmp/httpd/tmppage.html#P">P</A>' >> /tmp/httpd/tmppage.html
echo '<A HREF="/tmp/httpd/tmppage.html#Q">Q</A> <A HREF="/tmp/httpd/tmppage.html#R">R</A> <A HREF="/tmp/httpd/tmppage.html#S">S</A> <A HREF="/tmp/httpd/tmppage.html#T">T</A>' >> /tmp/httpd/tmppage.html
echo '<A HREF="/tmp/httpd/tmppage.html#U">U</A> <A HREF="/tmp/httpd/tmppage.html#V">V</A> <A HREF="/tmp/httpd/tmppage.html#W">W</A> <A HREF="/tmp/httpd/tmppage.html#X">X</A>' >> /tmp/httpd/tmppage.html
echo '<A HREF="/tmp/httpd/tmppage.html#Y">Y</A> <A HREF="/tmp/httpd/tmppage.html#Z">Z</A>' >> /tmp/httpd/tmppage.html
echo '</FONT></B>' >> /tmp/httpd/tmppage.html
echo '<hr>' >> /tmp/httpd/tmppage.html
endif
nawk -F^ ' BEGIN {i=65;s=0;letter ="^A.*";rletter = "A"} \
{ comp = $1\
if ( comp !~ letter ) {\
for ( x=i;x<=100; ++x ){\
letter = sprintf("^%c.*", x)\
rletter = sprintf("%c", x)\
if ( comp ~ letter ) {i=x;s=0;break}\
}\
}\
if ( comp ~ letter && s==0 ) {\
print "<DT><A NAME=\""rletter"\"><B>"rletter"</B><DD></A><a href=file:///tmp/httpd/.products/"$3"/index.html <b><b>"$1"</b></b></a>"$2"<br>";s=2 \
}\
if ( comp ~ letter && s==1) {\
print " <DD><a href=file:///tmp/httpd/.products/"$3"/index.html <b><b>"$1"</b></b></a>"$2"<br>"\
}\
s=1\
}' /tmp/httpd/top.sort >> /tmp/httpd/tmppage.html
endif
cat tail.html >> /tmp/httpd/tmppage.html
exit 0